//
// Created by tonystark on 16/3/29.
// Copyright (c) 2016 sewm. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "AFNetworking.h"

typedef void (^SuccessBlock)(id body);

typedef void (^FailBlock)(NSString *message, NSInteger code);

typedef void (^UploadProgBlock)(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite);

#define  kDESCKey     @"abcdefgh"

@interface Api : NSObject

+ (void)handleSuccess:(AFHTTPRequestOperation *)operation responseObject:(id)responseObject successBlock:(SuccessBlock)success failBlock:(FailBlock)fail;

+ (void)handleFailure:(AFHTTPRequestOperation *)operation error:(NSError *)error failBlock:(FailBlock)fail;

+ (AFHTTPRequestOperation *)getConnection:(SuccessBlock)success fail:(FailBlock)fail parameters:(NSDictionary *)paramDict method:(RequestMethod)method serviceName:(NSString *)serviceName;

+ (AFHTTPRequestOperation *)getConnection:(SuccessBlock)success fail:(FailBlock)fail bodyDict:(NSDictionary *)bodyDict service:(NSString *)serviceName mutiDatas:(NSArray *)datas;

@end

@interface ApiClient : AFHTTPRequestOperationManager

+ (instancetype)sharedInstance;

@end
